home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / plain C OS8 / Gadgets / Dispatcher.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-29  |  5.0 KB  |  265 lines  |  [TEXT/CWIE]

  1. /* Dispatcher.c */
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Controls.h>
  6. #include <Dialogs.h>
  7. #include <Events.h>
  8. #include <Lists.h>
  9. #include <Menus.h>
  10. #include <TextEdit.h>
  11.  
  12. #include "GadgetsApp.h"
  13. #include "GadgetsDoc.h"
  14. #include "GadgetsEngine.h"
  15. #include "Buttons.h"
  16. #include "TabbedPanel.h"
  17. #include "EditText.h"
  18. #include "AboutDialog.h"
  19.  
  20. #include "Globals.h"
  21. #include "Dispatcher.h"
  22.  
  23. /*----------*/
  24. void DoIdle (void)
  25. {
  26. }
  27.  
  28. //----------
  29. // windows
  30.  
  31. //----------
  32. void    Close (
  33.     AMWindow*        window)
  34. {
  35.     switch (GetClassID (window)) {
  36.     case classButtons:
  37.             Buttons_Close ((Buttons*) window);
  38.         break;
  39.     case classTabbedPanel:
  40.             TabbedPanel_Close ((TabbedPanel*) window);
  41.         break;
  42.     case classEditText:
  43.             EditText_Close ((EditText*) window);
  44.         break;
  45.     } // switch
  46. }
  47.  
  48. //----------
  49. void    DoTrack (
  50.     AMWindow*        window,
  51.     ControlHandle    whichControl,
  52.     short             whichPart,
  53.     Point            where)
  54. {
  55.     switch (GetClassID (window)) {
  56.     case classButtons:
  57.             Buttons_Track ((Buttons*) window, whichControl, whichPart, where);
  58.         break;
  59.     case classTabbedPanel:
  60.             TabbedPanel_Track ((TabbedPanel*) window, whichControl, whichPart, where);
  61.         break;
  62.     case classEditText:
  63.             EditText_Track ((EditText*) window, whichControl, whichPart, where);
  64.         break;
  65.     } // switch
  66. }
  67.  
  68. //----------
  69. void    MouseIn (
  70.     AMWindow*        window,
  71.     Point            where,
  72.     short            modifiers)
  73. {
  74.     switch (GetClassID (window)) {
  75.     case classButtons:
  76.             Buttons_MouseIn ((Buttons*) window, where, modifiers);
  77.         break;
  78.     case classTabbedPanel:
  79.             TabbedPanel_MouseIn ((TabbedPanel*) window, where, modifiers);
  80.         break;
  81.     case classEditText:
  82.             EditText_MouseIn ((EditText*) window, where, modifiers);
  83.         break;
  84.     } // switch
  85. }
  86.  
  87. //----------
  88. void    TypeIn (
  89.     AMWindow*        window,
  90.     char            ch)
  91. {
  92.     switch (GetClassID (window)) {
  93.     case classButtons:
  94.             Buttons_TypeIn ((Buttons*) window, ch);
  95.         break;
  96.     case classTabbedPanel:
  97.             TabbedPanel_TypeIn ((TabbedPanel*) window, ch);
  98.         break;
  99.     case classEditText:
  100.             EditText_TypeIn ((EditText*) window, ch);
  101.         break;
  102.     } // switch
  103. }
  104.  
  105. //----------
  106. void    Resize (
  107.     AMWindow*        window)
  108. {
  109.     switch (GetClassID (window)) {
  110.     case classButtons:
  111.             Buttons_Resize ((Buttons*) window);
  112.         break;
  113.     case classTabbedPanel:
  114.             TabbedPanel_Resize ((TabbedPanel*) window);
  115.         break;
  116.     case classEditText:
  117.             EditText_Resize ((EditText*) window);
  118.         break;
  119.     } // switch
  120. }
  121.  
  122. //----------
  123. void    Scroll (
  124.     AMWindow*        window,
  125.     short            newValue,
  126.     short            oldValue)
  127. {
  128.     switch (GetClassID (window)) {
  129.     case classButtons:
  130.             Buttons_Scroll ((Buttons*) window, newValue, oldValue);
  131.         break;
  132.     case classTabbedPanel:
  133.             TabbedPanel_Scroll ((TabbedPanel*) window, newValue, oldValue);
  134.         break;
  135.     case classEditText:
  136.             EditText_Scroll ((EditText*) window, newValue, oldValue);
  137.         break;
  138.     } // switch
  139. }
  140.  
  141. //----------
  142. Boolean    DoCommand (
  143.     AMWindow*        window,
  144.     long            inCommand)
  145. {
  146.     switch (GetClassID (window)) {
  147.     case classButtons:
  148.             return Buttons_DoCommand ((Buttons*) window, inCommand);
  149.         break;
  150.     case classTabbedPanel:
  151.             return TabbedPanel_DoCommand ((TabbedPanel*) window, inCommand);
  152.         break;
  153.     case classEditText:
  154.             return EditText_DoCommand ((EditText*) window, inCommand);
  155.         break;
  156.     } // switch
  157.     return false;
  158. }
  159.  
  160. //----------
  161. void    ExitCurField (
  162.     AMWindow*        window)
  163. {
  164.     switch (GetClassID (window)) {
  165.     case classButtons:
  166.             Buttons_ExitCurField ((Buttons*) window);
  167.         break;
  168.     case classTabbedPanel:
  169.             TabbedPanel_ExitCurField ((TabbedPanel*) window);
  170.         break;
  171.     case classEditText:
  172.             EditText_ExitCurField ((EditText*) window);
  173.         break;
  174.     } // switch
  175. }
  176.  
  177. //----------
  178. void    DataChanged (
  179.     AMResponder*    responder,
  180.     long            inDataID)
  181. {
  182.     switch (GetClassID (responder)) {
  183.     case classButtons:
  184.             Buttons_DataChanged ((Buttons*) responder, inDataID);
  185.         break;
  186.     case classTabbedPanel:
  187.             TabbedPanel_DataChanged ((TabbedPanel*) responder, inDataID);
  188.         break;
  189.     case classEditText:
  190.             EditText_DataChanged ((EditText*) responder, inDataID);
  191.         break;
  192.     case classAboutDialog:
  193.             AboutDialog_DataChanged ((AboutDialog*) responder, inDataID);
  194.         break;
  195.     } // switch
  196. }
  197.  
  198. //----------
  199. // dialogs
  200.  
  201. //----------
  202. void    FinishMake (
  203.     AMDialog*        dialog)
  204. {
  205.     switch (GetClassID (dialog)) {
  206.     case classAboutDialog:
  207.             AboutDialog_FinishMake ((AboutDialog*) dialog);
  208.         break;
  209.     } // switch
  210. }
  211.  
  212. //----------
  213. void    ConnectToData (
  214.     AMDialog*        dialog,
  215.     AMSignaler*        inData)
  216. {
  217.     switch (GetClassID (dialog)) {
  218.     case classAboutDialog:
  219.             AboutDialog_ConnectToData ((AboutDialog*) dialog, inData);
  220.         break;
  221.     } // switch
  222. }
  223.  
  224. //----------
  225. void    DoItem (
  226.     AMDialog*        dialog,
  227.     SInt16            inItemHit)
  228. {
  229.     switch (GetClassID (dialog)) {
  230.     case classAboutDialog:
  231.             AboutDialog_DoItem ((AboutDialog*) dialog, inItemHit);
  232.         break;
  233.     } // switch
  234. }
  235.  
  236. //----------
  237. Boolean        Filter (
  238.     AMDialog*            dialog,
  239.     EventRecord            *ioEvent,
  240.     DialogItemIndex        *outItemHit)
  241. {
  242.     switch (GetClassID (dialog)) {
  243.     case classAboutDialog:
  244.             return AboutDialog_Filter ((AboutDialog*) dialog, ioEvent, outItemHit);
  245.         break;
  246.     } // switch
  247.     return false;    // not filtered => Dialog Manager takes it
  248. }
  249.  
  250. //----------
  251. // modeless dialogs
  252.  
  253. /*----------*/
  254. void    InitModelessDialogs (void)
  255. {
  256.  
  257. }
  258.  
  259. /*----------*/
  260. void    CloseModelessDialog (
  261.     DialogPtr        whichDialog)
  262. {
  263.  
  264. }
  265.